<?php

define('BASE_ROOT_PATH', dirname(dirname(__FILE__)));
include_once( BASE_ROOT_PATH . "/word/db/DBMySQL.php");

$memberId = $_REQUEST['id'];
if(empty($memberId)) {
	$msg = json_encode("用户id不能为空");
	echo '{"code":"1","msg":'.$msg.'}';
	exit();
}
//过滤类型
$filterType = $_REQUEST['type'];
if(!isset($filterType)) {
	$filterType = '0';
}
$filterType = str_replace('\'', '\'\'', $filterType);
//理想学校
$dreamschool = $_REQUEST['dreamschool'];
if(empty($dreamschool)) {
	$dreamschool = '';
}
$dreamschool = str_replace('\'', '\'\'', $dreamschool);

//考试年份
$examyear = $_REQUEST['examyear'];
if(empty($examyear)) {
	$examyear = '';
}
$examyear = str_replace('\'', '\'\'', $examyear);

//考试月份
$exammonth = $_REQUEST['exammonth'];
if(empty($exammonth)) {
	$exammonth = '';
}
$exammonth = str_replace('\'', '\'\'', $exammonth);

//考试城市
$examaddress = $_REQUEST['examaddress'];
if(empty($examaddress)) {
	$examaddress = '';
}
$examaddress = str_replace('\'', '\'\'', $examaddress);

// 查找用户
$db = new DBMySQL();
$rs = $db->Query("select mi.member_id,m.email from t_member m join t_member_info mi on mi.member_id = m.member_id where m.member_id = $memberId limit 1");
if(empty($rs)) {
	$msg = json_encode("该用户不存在");
	echo '{"code":"1","msg":'.$msg.'}';
	exit();
}
$val = $rs[0];
$memberId = $val['member_id'];
$db->Modify("update t_member_info mi set mi.filter_type='$filterType',mi.dreamschool='$dreamschool',mi.exam_year='$examyear',mi.exam_month='$exammonth',mi.exam_address='$examaddress' where mi.member_id = $memberId");
echo '{"code":"0","msg":""}';

?>